package cn.funnyxb.powerremember.db.tables;

import android.database.Cursor;
import cn.funnyxb.powerremember.beans.ATask;
import cn.funnyxb.tools.appFrame.database.DBHolder;
import cn.funnyxb.tools.appFrame.database.DBService;
import cn.funnyxb.tools.appFrame.database.TableHolder;
import cn.funnyxb.tools.appFrame.debugTool.Debuger;

public class Tbholder_tasksinfo extends TableHolder
{
  private boolean inited = false;

  public Tbholder_tasksinfo(DBHolder paramDBHolder)
    throws Exception
  {
    super(paramDBHolder, "taskinfo");
    if (this.inited)
      throw new Exception("has inited!");
    this.inited = true;
  }

  private void log(String paramString)
  {
    Debuger.log("tbh_task", paramString);
  }

  public void clearStudyLogInfo(int paramInt)
  {
    DBService localDBService = this.dbHolder.getDbService();
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = Integer.valueOf(paramInt);
    localDBService.execSql("update taskinfo set laststudydate = 0 , groupcnt_learned = 0 , groupcnt_passed = 0 , groupidx_laststudy = 0 where _id = ?", arrayOfObject);
  }

  public void deleteTaskById(int paramInt)
  {
    DBService localDBService = getDbHolder().getDbService();
    Object[] arrayOfObject = new Object[1];
    arrayOfObject[0] = Integer.valueOf(paramInt);
    localDBService.execSql("delete from taskinfo where _id = ? ", arrayOfObject);
  }

  public int getTaskId(String paramString)
  {
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[1];
    arrayOfString[0] = paramString;
    Cursor localCursor = localDBService.query("select *  from taskinfo where name = ? ", arrayOfString);
    if (localCursor == null);
    int i;
    for (int j = -1; ; j = i)
    {
      while (true)
      {
        return j;
        if (localCursor.getCount() >= 1)
          break;
        localCursor.close();
        j = -1;
      }
      localCursor.moveToFirst();
      i = localCursor.getInt(localCursor.getColumnIndex("_id"));
      localCursor.close();
    }
  }

  public void insertARecord(ATask paramATask)
  {
    insertARecord(paramATask.getName(), paramATask.getWordCnt(), paramATask.getGroupSize(), paramATask.getGroupOfOneDay(), paramATask.getWordBaseName());
  }

  public void insertARecord(String paramString1, int paramInt1, int paramInt2, int paramInt3, String paramString2)
  {
    DBService localDBService = this.dbHolder.getDbService();
    Object[] arrayOfObject = new Object[6];
    arrayOfObject[0] = paramString1;
    arrayOfObject[1] = Long.valueOf(System.currentTimeMillis());
    arrayOfObject[2] = Integer.valueOf(paramInt1);
    arrayOfObject[3] = Integer.valueOf(paramInt2);
    arrayOfObject[4] = Integer.valueOf(paramInt3);
    arrayOfObject[5] = paramString2;
    localDBService.execSql("insert into taskinfo(name,createdate,wordcount,groupsize,groupsofoneday,wordbasename) values(?,?,?,?,?,?)", arrayOfObject);
  }

  public Cursor queryAtaskByName(String paramString)
  {
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[1];
    arrayOfString[0] = paramString;
    return localDBService.query("select * from taskinfo where name=?", arrayOfString);
  }

  public ATask queryTaskInfoById(int paramInt)
  {
    log("queryTaskInfoById=" + paramInt);
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[1];
    arrayOfString[0] = String.valueOf(paramInt);
    Cursor localCursor = localDBService.query("select * from taskinfo where _id = ? ", arrayOfString);
    if (localCursor == null);
    ATask localATask;
    for (Object localObject = null; ; localObject = localATask)
    {
      while (true)
      {
        return localObject;
        if (localCursor.getCount() != 0)
          break;
        localCursor.close();
        localObject = null;
      }
      localCursor.moveToFirst();
      localATask = ATask.parseFromCursorOfTaskInfo(localCursor);
      localCursor.close();
    }
  }

  public void removeTask(String paramString)
  {
    DBService localDBService = this.dbHolder.getDbService();
    String[] arrayOfString = new String[1];
    arrayOfString[0] = paramString;
    localDBService.execSql("delete  from taskinfo where name = ?", arrayOfString);
  }

  public void synchronousTaskInfo_study(int paramInt1, int paramInt2, int paramInt3, long paramLong)
  {
    DBService localDBService = this.dbHolder.getDbService();
    Object[] arrayOfObject = new Object[4];
    arrayOfObject[0] = Long.valueOf(paramLong);
    arrayOfObject[1] = Integer.valueOf(paramInt2);
    arrayOfObject[2] = Integer.valueOf(paramInt3);
    arrayOfObject[3] = Integer.valueOf(paramInt1);
    localDBService.execSql("update taskinfo set laststudydate = ? , groupidx_laststudy = ? , groupcnt_learned = ?  where _id = ?", arrayOfObject);
  }

  public void updateTaskBaseInfo(ATask paramATask)
  {
    DBService localDBService = this.dbHolder.getDbService();
    Object[] arrayOfObject = new Object[3];
    arrayOfObject[0] = Integer.valueOf(paramATask.getGroupSize());
    arrayOfObject[1] = Integer.valueOf(paramATask.getGroupOfOneDay());
    arrayOfObject[2] = Integer.valueOf(paramATask.getId());
    localDBService.execSql("update taskinfo set groupsize = ? ,groupsofoneday = ?  where _id = ? ", arrayOfObject);
  }

  public void updateTaskBaseInfoAndGroupSize(ATask paramATask)
  {
    DBService localDBService = this.dbHolder.getDbService();
    Object[] arrayOfObject = new Object[4];
    arrayOfObject[0] = Integer.valueOf(paramATask.getGroupOfOneDay());
    arrayOfObject[1] = Integer.valueOf(paramATask.getGroupSize());
    arrayOfObject[2] = Long.valueOf(System.currentTimeMillis());
    arrayOfObject[3] = Integer.valueOf(paramATask.getId());
    localDBService.execSql("update taskinfo set groupsofoneday = ? ,groupsize = ? ,lastmodifydate = ? ,hasfinishedgroups = 0 ,groupcnt_learned = 0 ,groupcnt_passed = 0 ,groupidx_laststudy = 0  where _id = ? ", arrayOfObject);
  }
}

/* Location:           E:\Desktop\复件 classes_dex2jar.jar
 * Qualified Name:     cn.funnyxb.powerremember.db.tables.Tbholder_tasksinfo
 * JD-Core Version:    0.5.3
 */